package designPattern.producersConsumer;
/**
 * 主函数
 * 生产者消费者模式的尝试
 * @author zhaohuihbwj
 * 改动：将仓库改为单例模式
 * 修改时间：2017年4月6日
 */
public class App {
    public static void main(String[] args) {
        // 生产者
        Producer p1 = new Producer(10);
        Producer p2 = new Producer(10);
        Producer p3 = new Producer(30);
        Producer p4 = new Producer(10);

        // 消费者
        Customer c1 = new Customer(20);
        Customer c2 = new Customer(40);

        // 生产者线程
        Thread t1 = new Thread(p1);
        Thread t2 = new Thread(p2);
        Thread t3 = new Thread(p3);
        Thread t4 = new Thread(p4);

        // 消费者线程
        Thread t5 = new Thread(c1);
        Thread t6 = new Thread(c2);

        t1.start();
        t2.start();
        t3.start();
        t4.start();
        t5.start();
        t6.start();
    }
}
